﻿using System.Data.Common;
using System.Data.Entity;
using Abp.Zero.EntityFramework;
using MyCompanyName.AbpZeroTemplate.Authorization.Roles;
using MyCompanyName.AbpZeroTemplate.Authorization.Users;
using MyCompanyName.AbpZeroTemplate.Chat;
using MyCompanyName.AbpZeroTemplate.Friendships;
using MyCompanyName.AbpZeroTemplate.MultiTenancy;
using MyCompanyName.AbpZeroTemplate.Storage;

namespace MyCompanyName.AbpZeroTemplate.EntityFramework
{
    //[DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))]
    public class AbpZeroTemplateDbContext : AbpZeroDbContext<Tenant, Role, User>
    {
        /* Define an IDbSet for each entity of the application */

        public virtual IDbSet<BinaryObject> BinaryObjects { get; set; }

        public virtual IDbSet<Friendship> Friendships { get; set; }

        public virtual IDbSet<ChatMessage> ChatMessages { get; set; }

        //代理商
        public virtual IDbSet<Agent.Agent> Agents { get; set; }
        //代理商转账记录
        public virtual IDbSet<Agent.AgentTransfer> AgentTransfers { get; set; }
        //代理商充值记录
        public virtual IDbSet<Agent.AgentRecharge> AgentRecharges { get; set; }

        //产品
        public virtual IDbSet<Product.Product> Products { get; set; }

        //卡片日用量
        public virtual IDbSet<DailyReport.DailyReport> DailyReports { get; set; }

        //套餐购买记录表
        public virtual IDbSet<Product.ProductRelationShip> ProductRelationShips { get; set; }

        //------------------------------------------------------------------------------------------

        /// <summary>
        /// 卡片管理
        /// </summary>
        public virtual IDbSet<Card.Card> Cards { get; set; }

        /// <summary>
        /// 卡片月用量
        /// </summary>
        public virtual IDbSet<MonthReport.MonthReport> MonthReports { get; set; }

        /// <summary>
        /// 卡片充值记录
        /// </summary>
        public virtual IDbSet<CardRechargeLog.CardRechargeLog> CardRechargeLogs { get; set; }

        /// <summary>
        /// 划卡计录
        /// </summary>
        public virtual IDbSet<TransferCardLog.TransferCardLog> TransferCardLogs { get; set; }


        /// <summary>
        /// 系统参数配置
        /// </summary>
        public virtual IDbSet<SystemSetting.SystemSetting> SystemSettings { get; set; }


        /* Setting "Default" to base class helps us when working migration commands on Package Manager Console.
         * But it may cause problems when working Migrate.exe of EF. ABP works either way.         * 
         */
        public AbpZeroTemplateDbContext()
            : base("Default")
        {

        }

        /* This constructor is used by ABP to pass connection string defined in AbpZeroTemplateDataModule.PreInitialize.
         * Notice that, actually you will not directly create an instance of AbpZeroTemplateDbContext since ABP automatically handles it.
         */
        public AbpZeroTemplateDbContext(string nameOrConnectionString)
            : base(nameOrConnectionString)
        {

        }

        /* This constructor is used in tests to pass a fake/mock connection.
         */
        public AbpZeroTemplateDbContext(DbConnection dbConnection)
            : base(dbConnection, true)
        {

        }
    }
}
